$().ready(function(){

    var nav = getSearch('nav');
    if(nav == 5){
        var item = getSearch('item');
        var classId = getSearch('class');
        var contentMain = '';
        let className = '';
        let itemName = '';
        for(let i in layoutMain.list){
            if(classId == layoutMain.list[i].id){
                className = layoutMain.list[i].class_name;
                for(let j in layoutMain.list[i].content){
                    if(item == layoutMain.list[i].content[j].id){
                        itemName = layoutMain.list[i].content[j].title;
                        contentMain = layoutMain.list[i].content[j].content;
                        $('#content-box').html(contentMain)
                    }
                }
                // contentMain = layoutMain
            }
        }
        var breadcream = '<a href="index.html">首页</a>';
        breadcream += '<a href="index.html">'+layoutMain.name+'</a>';
        breadcream += '<a href="nav-page.html?nav='+layoutMain.id+'&class='+classId+'">'+className+'</a>';
        breadcream += '<a href="">'+itemName+'</a>';
        $('#breadcream').html(breadcream);
    }else if(nav == 3){
        var navList = {};
        for(let i in mainList){
            if(nav == mainList[i].id){
                navList = mainList[i];
            }
        }
        var item = getSearch('item');
        // console.log(item);
        var navItem = '';
        for(let j in navList.list){
            if(item == navList.list[j].id){
                navItem = navList.list[j];
            }
        }
        console.log(navItem);
        var breadcream = '<a href="index.html">首页</a>';
        breadcream += '<a href="'+navList.link+'?nav='+navList.id+'">'+navList.name+'</a>';
        breadcream += '<a href="">'+navItem.title+'</a>';
        $('#breadcream').html(breadcream);
        $('#content-box').html(navItem.content)
    }else if(nav == 6){
        let item = getSearch('item');
        let navList = footerList;
        for(let j in navList.list){
            if(item == navList.list[j].id){
                navItem = navList.list[j];
            }
        }
        var breadcream = '<a href="index.html">首页</a>';
        breadcream += '<a href="'+navList.link+'?nav='+navList.id+'">'+navList.name+'</a>';
        breadcream += '<a href="">'+navItem.name+'</a>';
        $('#breadcream').html(breadcream);
        let apiUrl = '';
        if(item == 20){
            apiUrl = '/Api/New/get_yszc';
        }else if(item == 21){
            apiUrl = '/Api/New/get_flzc';
        }
        getAjax(apiUrl,res=>{
            console.log(res);
            var html = res.content;
            // if(nav == 5){
            //     html = res.content;
            // }else{
            //     html = res[0].content;
            // }
            $('#content-box').html(html)
        })
    }else{
        var navList = {};
        for(let i in mainList){
            if(nav == mainList[i].id){
                navList = mainList[i];
            }
        }
        var item = getSearch('item');
        // console.log(item);
        var navItem = '';
        for(let j in navList.list){
            if(item == navList.list[j].id){
                navItem = navList.list[j];
            }
        }

        var breadcream = '<a href="index.html">首页</a>';
        breadcream += '<a href="'+navList.link+'?nav='+navList.id+'">'+navList.name+'</a>';
        breadcream += '<a href="">'+navItem.name+'</a>';
        $('#breadcream').html(breadcream);
        var apiUrl;
        if(item == 1){
            apiUrl = '/Api/New/get_jtjs';
        }else if(item == 2){
            apiUrl = '/Api/New/get_dszzc';
        }else if(item == 4){
            apiUrl = '/Api/New/get_qywh';
        }else if(item == 7){
            apiUrl = '//Api/New/get_cyjd';
        }
        getAjax(apiUrl,res=>{
            console.log(res);
            var html = res[0].content;
            // if(nav == 5){
            //     html = res.content;
            // }else{
            //     html = res[0].content;
            // }
            $('#content-box').html(html)
        })
    }


})
